﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Mimoza.Common
{
    public class ArrayToString
    {
        const char Separator = ';';

        static public string ToString(string[] strs)
        {
            string result = "";
            foreach (string str in strs)
            {
                if (!string.IsNullOrEmpty(result)) result += Separator;

                result += str;
            }

            return result;
        }

        static public string[] FromString(string str)
        {
            if (str==null) return null;
            char[] separators = new char[1];
            separators[0] = Separator;

            return str.Split(separators);
        }

        static public bool IsSeparatedString(string str)
        {
            if (string.IsNullOrEmpty(str)) return false;

            return (str.IndexOf(Separator)>=0);
        }
    }
}
